<a name="chat"></a>
<!-- IF not $S_IN_PORTAL -->
<div class="forumbg">
<div class="inner"><span class="corners-top"><span></span></span>
<ul class="topiclist">
	<li class="header">
		<dl class="icon">
			<dd style="width:100%;">&nbsp;<div style="float:left;"><a id="chat_enter" href="{U_CHAT_LINK}"><!-- IF S_CHAT_NOTIN -->{L_CHAT_ENTER}<!-- ELSE -->{L_CHAT_EXIT}<!-- ENDIF --></a></div><div style="float:right;" id="clock"></div>&nbsp;</dd>
		</dl>
	</li>
</ul>
<!-- ELSE -->
{$C_BLOCK_H_L}<div style="float:left;"><!-- IF $S_BLOCK_ICON --><img src="{$IMAGE_SRC}" width="{$IMAGE_WIDTH}" height="{$IMAGE_HEIGHT}" alt="" />&nbsp;<!-- ENDIF --><a id="chat_enter" href="{U_CHAT_LINK}"><!-- IF S_CHAT_NOTIN -->{L_CHAT_ENTER}<!-- ELSE -->{L_CHAT_EXIT}<!-- ENDIF --></a></div><div style="float:right;" id="clock"></div>{$C_BLOCK_H_R}
<!-- ENDIF -->

<!-- IF S_CHAT_NOTIN and CHAT_MINIMIZED -->
<script type="text/javascript">
// <![CDATA[
	jQuery(document).ready(
	function($)
	{
		$("#chat_area").hide();
		$("#chat_enter").mouseover(function () {
			$("#chat_area").show();
			return false;
		});
		$("#chat_enter").mouseout(function () {
			$("#chat_area").hide();
			return false;
		});
	}
);
// ]]>
</script>
<!-- ENDIF -->

<ul class="topiclist topics" id="chat_area">
	<li class="row bg1">
		<dl class="icon">
			<dd class="lastpost" style="width:100%">
			<!-- IF S_IS_POSTABLE -->
			<!-- IF not S_CHAT_NOTIN -->
			<!-- IF S_BBCODE_ENABLED -->
			<script src="{PPKBB3CKER_ADDONS}js/editor.js" type="text/javascript"></script>
			<script src="{PPKBB3CKER_ADDONS}js/bbcode.js" type="text/javascript"></script>
			<!-- ENDIF -->
			<!-- IF ARCH_OPT -->
			<script src="{PPKBB3CKER_ADDONS}js/jquery.toajax.js" type="text/javascript"></script>
			<!-- ENDIF -->
			<script type="text/javascript">
			// <![CDATA[
				function start_clock()
				{
					var tick;
					var ut=new Date();
					var h,m,s;
					var time="";
					h=ut.getHours();
					m=ut.getMinutes();
					s=ut.getSeconds();
					if(s<=9) s="0"+s;
					if(m<=9) m="0"+m;
					if(h<=9) h="0"+h;
					time+=h+":"+m+":"+s;
					document.getElementById('clock').innerHTML=time;
					tick=setTimeout("start_clock()",1000);
				}
			<!-- IF S_BBCODE_ENABLED -->
				var form_name = 'text';
				var text_name = 'message';
				var bbtags = new Array('[b]','[/b]','[i]','[/i]','[u]','[/u]','[s]','[/s]','[samp]','[/samp]','[color=]','[/color]','[size=]','[/size]','[url]','[/url]','[url=]','[/url]','[q]','[/q]','[blockquote]','[/blockquote]','[pre]','[/pre]','[code]','[/code]','[noparse]','[/noparse]'<!-- IF S_BBCODE_IMG -->,'[img=]','[/img]'<!-- ENDIF -->);
			<!-- ENDIF -->
			jQuery(document).ready(
				function($)
				{
					start_clock();

					handle_send("read", 0);
					<!-- IF ARCH_OPT -->
					$("#varch").toAJAX();
					<!-- ENDIF -->
					var s = {CHAT_HSTEP};
					var sMax={CHAT_HMAX};
					var sMin={CHAT_HMIN};
					ch=getCookie('chatHeight');
					if(!isNaN(ch) && (ch >= sMin && ch <= sMax))
					{
						$(window).load(function () {
							$(".smilies").animate({
								height: ch
								}, 0);
							$(".shouts").animate({
								height: ch
								}, 0);
							$(".users").animate({
								height: ch
								}, 0);
							$(".chat_window").animate({
								height: ch
								}, 0);
						});
					}
					oh=$('.users').height();
					$(".chat_mheight").click(function () {
						h=$('.users').height();
						if(h-s > sMin)
						{
							setCookie('chatHeight', h-s, 7);
							$('.users').css('height', h-s);
							$('.shouts').css('height', h-s);
							$('.smilies').css('height', h-s);
							$('.chat_window').css('height', h-s);
						}
					});
					$(".chat_pheight").click(function () {
						h=$('.users').height();
						if(h+s < sMax)
						{
							setCookie('chatHeight', h+s, 7);
							$('.users').css('height', h+s);
							$('.shouts').css('height', h+s);
							$('.smilies').css('height', h+s);
							$('.chat_window').css('height', h+s);
						}
					});
					$(".chat_height").click(function () {
						setCookie('chatHeight', oh, 7);
						$('.users').css('height', oh);
						$('.shouts').css('height', oh);
						$('.smilies').css('height', oh);
						$('.chat_window').css('height', oh);
					});
				}
			);
			function getCookie(name)
			{
				var start = document.cookie.indexOf( name + "=" );
				var len = start + name.length + 1;
				if ((!start) && (name != document.cookie.substring( 0, name.length)))
				{
					return null;
				}
				if (start == -1) return null;
				var end = document.cookie.indexOf(';', len);
				if (end == -1) end = document.cookie.length;
				return unescape(document.cookie.substring(len, end));
			}

			function setCookie (name, value, expires, path, domain, secure)
			{
				var today = new Date();
				today.setTime(today.getTime());
				if (expires)
				{
					expires = expires * 1000 * 60 * 60 * 24;
				}
				var expires_date = new Date( today.getTime() + (expires));
				document.cookie = name+'='+escape( value ) +
				((expires) ? ';expires='+expires_date.toGMTString() : '' ) + //expires.toGMTString()
				((path) ? ';path=' + path : '' ) +
				((domain) ? ';domain=' + domain : '' ) +
				((secure) ? ';secure' : '' );
			}

			function deleteCookie (name, path, domain)
			{
				if (getCookie(name)) document.cookie = name + '=' +
				((path) ? ';path=' + path : '') +
				((domain) ? ';domain=' + domain : '' ) +
				';expires=Thu, 01-Jan-1970 00:00:01 GMT';
			}

			var fieldname = 'chat_window';
			var last_time = {TIME};
			var xmlHttp = http_object();
			var last_id = {LAST_ID};
			var type = 'receive';
			var post_time = {TIME};
			var read_interval = {REFRESH};
			var interval = setInterval('handle_send("read", last_id);', read_interval);

			function handle_send(mode, f)
			{
				if(document.text.message.value=='' && (mode != 'read' && mode != 'delete' && mode != 'get_gmode' && mode != 'set_hidden' && mode != 'acomm'))
				{
					return false;
				}
				<!-- IF CHATPM_OPT -->
				if(mode=='add' && document.text.to_user_id.value!=0 && !document.getElementById('u'+document.text.to_user_id.value))
				{
					document.text.to_user.value = '';
					document.text.to_user_id.value = 0;
					document.getElementById('to_user').style.display = 'none';
					/*if(!confirm('{L_CHAT_PMUSER_EXITED}'))
					{*/
						document.text.message.value = '';
						return false;
					//}
				}
				<!-- ENDIF -->
				if (xmlHttp.readyState == 4 || xmlHttp.readyState == 0)
				{
					indicator_switch('on');
					type = 'receive';
					param = 'mode=' + mode;
					//param += '&last_id=' + last_id;
					//param += '&last_time=' + last_time;
					//param += '&last_post=' + post_time;
					//param += '&read_interval=' + read_interval;
					<!-- IF GMODE_OPT -->
					param += '&get_gmode='+document.text.u_gmode.checked;
					param += '&to_room='+document.text.to_room.value;
					<!-- ENDIF -->
					<!-- IF CHATPM_OPT -->
					param += '&to_user='+document.text.to_user.value;
					param += '&to_user_id='+document.text.to_user_id.value;
					<!-- ENDIF -->

					if (mode == 'add' && document.text.message.value != '')
					{
						type = 'send';
						for(var i = 0; i < f.elements.length; i++)
						{
							elem = f.elements[i];
							param += '&' + elem.name + '=' + encodeURIComponent(elem.value);
						}
						document.text.message.value = '';
					}
					else if (mode == 'delete')
					{
						type = 'delete';
						param += '&del_mess=' + f;
					}
					<!-- IF HIDDEN_OPT -->
					else if (mode == 'set_hidden')
					{
						type = 'set_hidden';
						param += '&set_hidden=' + f;
					}
					<!-- ENDIF -->
					<!-- IF ACOMMANDS_OPT -->
					else if (mode == 'acomm')
					{
						type = 'acomm';
						param += '&acomm=' + f;
					}
					<!-- ENDIF -->
					<!-- IF IN_CHAT -->document.text.message.focus();<!-- ENDIF -->
					xmlHttp.open("POST", '{FILENAME}', true);
					xmlHttp.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded');
					xmlHttp.onreadystatechange = handle_return;
					xmlHttp.send(param);
				}
			}

			function handle_return()
			{
				if (xmlHttp.readyState == 4)
				{
					if (type != 'delete')
					{
						results = xmlHttp.responseText.split('---');
						//if (results[0])
						//{
							//if (last_id == 0)
							//{
								<!-- IF S_BBCODE_ENABLED -->
								var messages=results[0].split("</div>");
								for(i=0;i<messages.length;i++)
								{
									messages[i]=parseBBCode(messages[i]);
								}
								document.getElementById(fieldname).innerHTML = messages.join('</div>');
								<!-- ELSE -->
								document.getElementById(fieldname).innerHTML = results[0];
								<!-- ENDIF -->
							//}
							//else
							//{
								//document.getElementById(fieldname).innerHTML = results[0] + document.getElementById(fieldname).innerHTML;
							//}
							//last_id = results[1];
							//if (results[2])
							//{
								document.getElementById('users').innerHTML = results[2];
								//last_time = results[3];
							//}
							/*if (results[4] != read_interval)
							{
								window.clearInterval(interval);
								read_interval = results[4];
								interval = setInterval('handle_send("read", last_id);', read_interval);
								//document.getElementById('update_seconds').innerHTML = results[4];
							}*/
							if(results[5]!=0)
							{
								killtime(results[5]);
							}
						//}
					}
					indicator_switch('off');
				}
			}

			function delete_post(chatid)
			{
				if(confirm('{L_CHAT_DELMESS}'))
				{
					document.getElementById('p' + chatid).style.display = 'none';
					handle_send('delete', chatid);
				}
			}
			<!-- IF HIDDEN_OPT -->
			function set_hidden()
			{
				/*if(document.getElementById("hid_indicator"))
				{
					var img = document.getElementById("hid_indicator");
					if(img.style.visibility == "hidden")
					{
						img.style.visibility = "visible";
					}
					else
					{
						img.style.visibility = "hidden";
					}
				}*/

				handle_send('set_hidden', document.text.u_hidden.checked);
			}
			<!-- ENDIF -->
			<!-- IF GMODE_OPT -->
			function get_gmode()
			{
				if(document.getElementById("to_room"))
				{
					//var img = document.getElementById("gmode_indicator");
					if(document.getElementById('to_room').style.display=='none')
					{
						document.getElementById('to_room').style.display = '';
						//img.style.visibility = "visible";
					}
					else
					{
						document.text.to_room.value = '';
						document.getElementById('to_room').style.display = 'none';
						//img.style.visibility = "hidden";
					}
				}

				handle_send('get_gmode', document.text.u_gmode.checked);
			}
			function insertroom(room)
			{
				if(room!=0 && room!='')
				{
					document.text.to_room.value = room;
				}
				else
				{
					document.text.to_room.value = '';
				}
				document.text.message.focus();
			}
			<!-- ENDIF -->
			<!-- IF ACOMMANDS_OPT -->
			function aopts(uid, aid, ban_type)
			{
				if(uid!=aid)
				{
					document.getElementById('aopts'+uid).innerHTML = (ban_type=='ban' ? '<a href="javascript:void(0);" onClick="javascript:userkick('+uid+');" title="{L_CHAT_KICKHLP}"><img src="{ROOT_PATH}chat/images/status_unknown.png" alt="{L_CHAT_KICK}" /></a> <a href="javascript:void(0);" onClick="javascript:userban('+uid+');" title="{L_CHAT_BANHLP}"><img src="{ROOT_PATH}chat/images/messagebox_critical.png" alt="{L_CHAT_BAN}" /></a> <a href="javascript:void(0);" onClick="javascript:userquickban('+uid+');" title="{L_CHAT_QUICKBANHLP}"><img src="{ROOT_PATH}chat/images/agt_action_fail1.png" alt="{L_CHAT_QUICKBAN}" /></a>' : ' <a href="javascript:void(0);" onClick="javascript:userunban('+uid+');" title="{L_CHAT_UNBANHLP}"><img src="{ROOT_PATH}chat/images/agt_action_success.png" alt="{L_CHAT_UNBAN}" /></a>');
				}
			}
			function userkick(uid)
			{
				if(confirm('{L_CHAT_UKICK}'))
				{
					handle_send('acomm', '/k ' + uid);
				}
			}
			function uclean()
			{
				if(confirm('{L_CHAT_DELETE_USERS}'))
				{
					handle_send('acomm', '/u');
				}
			}
			function mclean(uid)
			{
				if(confirm('{L_CHAT_DELETE_MESS}'))
				{
					handle_send('acomm', '/m');
				}
			}
			function aclean(uid)
			{
				if(confirm('{L_CHAT_DELETE_AMESS}'))
				{
					handle_send('acomm', '/r');
				}
			}
			function userunban(uid)
			{
				if(confirm('{L_CHAT_UUNBAN}'))
				{
					if(document.text.to_user_id.value==uid)
					{
						document.text.to_user_id.value=0;
						document.getElementById('to_user').style.display = 'none';
					}
					handle_send('acomm', '/a ' + uid);
				}
			}
			function userquickban(uid)
			{
				if(confirm('{L_UBAN_CONFIRM} {QBAN_TIME} {L_UBAN_CONFIRM2}'))
				{
					if(document.text.to_user_id.value==uid)
					{
						document.text.to_user_id.value=0;
						document.getElementById('to_user').style.display = 'none';
					}
					handle_send('acomm', '/q ' + uid);
				}
			}
			function userban(uid)
			{
				var ban_time = eval(prompt("{L_UBAN_TIME}:", 0))
				if(ban_time)
				{
					if(confirm('{L_UBAN_CONFIRM} '+ban_time+ ' {L_UBAN_CONFIRM2}'))
					{
						handle_send('acomm', '/b ' + uid + ' ' + ban_time);
					}
				}
			}
			<!-- ENDIF -->
			function indicator_switch(mode)
			{
				if(document.getElementById("act_indicator"))
				{
					var img = document.getElementById("act_indicator");
					if(img.style.visibility == "hidden" && mode == 'on')
					{
						img.style.visibility = "visible";
					}
					else if (mode == 'off')
					{
						img.style.visibility = "hidden";
					}
				}
			}

			function http_object()
			{
				if (window.XMLHttpRequest)
				{
					return new XMLHttpRequest();
				}
				else if(window.ActiveXObject)
				{
					return new ActiveXObject("Microsoft.XMLHTTP");
				}
				else
				{
					document.getElementById('chat_window').innerHTML = 'Status: Cound not create XmlHttpRequest Object.  Consider upgrading your browser.';
				}
			}
			<!-- IF CHATPM_OPT -->
			function insertuname(uname, uid)
			{
				if(uname!='' && uid!=0 && uid!={USER_ID})
				{
					if(document.text.to_user_id.value!=uid)
					{
						document.text.to_user.value = uname;
						document.text.to_user_id.value = uid;
						//document.getElementById('u'+uid).style.textDecoration ='underline';
						document.getElementById('to_user').style.display = '';
					}
					else
					{
						document.text.to_user.value = '';
						document.text.to_user_id.value = 0;
						//document.getElementById('u'+uid).style.textDecoration ='none';
						document.getElementById('to_user').style.display = 'none';
					}
				}
				else
				{
					document.text.to_user.value = '';
					document.text.to_user_id.value = 0;
					//document.getElementById('u'+uid).style.textDecoration ='none';
					document.getElementById('to_user').style.display = 'none';
				}
				document.text.message.focus();
			}
			<!-- ENDIF -->
			function inserttext(str)
			{
				if(str!='')
				{
					document.text.message.value += str;
				}
				else
				{
					document.text.message.value = '';
				}
				document.text.message.focus();
			}
			function fulltime()
			{
				document.text.submit.disabled=true;
				if(document.text.submit.value > 0)
				{
					document.text.submit.value-=1;
				}
				else if(document.text.submit.value == 0)
				{
					document.text.submit.value = '{L_CHAT_SEND}';
					document.text.submit.disabled=false;
					document.text.message.focus();
					return;
				}
				else
				{
					document.text.submit.value = {WAITTIME};
				}

				setTimeout('fulltime()', 1000);
			}

			function killtime(r)
			{
				if(r)
				{
					document.location.href='./viewchat.{PHPEX}?f={FORUM_ID}&chat=exit&r='+r;
				}
			}
			// ]]>
			</script>
			<!-- ENDIF -->
			<link rel="stylesheet" href="{ROOT_PATH}chat/css/stylesheet_chat.css" type="text/css" />
			<table width="100%" cellspacing="1">
			<tr align="center" class="bg2"<!-- IF not S_FORM_WINDOW --> style="display:none;"<!-- ENDIF -->>
				<td colspan="3" height="25">
					<form name="text" id="text" method="post" action="javascript:void(0);" onsubmit="handle_send('add', this);{FULLTIME}" autocomplete="off">
					<strong style="color:#000000;">{L_MESSAGE}: </strong><!-- IF CHATPM_OPT --><input type="text" maxlength="64" tabindex="2" name="to_user" id="to_user" size="10" style="display:none;" /> <!-- ENDIF --><input type="text" maxlength="255" tabindex="1" name="message" id="message" class="inputbox chatinput" />&nbsp;<img alt="" src="{ROOT_PATH}chat/images/act_indicator.gif" id="act_indicator" />&nbsp;
					<input type="submit" class="button1" value="{L_CHAT_SEND}" name="submit" tabindex="6" accesskey="s"/><input class="button1" type="reset" value="{L_CHAT_RESET}" /><!-- IF HIDDEN_OPT -->&nbsp;<img style="width:16px;height:16px;vertical-align:middle;" id="hid_indicator" src="{ROOT_PATH}chat/images/overview.png" alt="" /> {HIDDEN_OPT}<!-- ENDIF --><!-- IF GMODE_OPT -->&nbsp;<img style="width:16px;height:16px;vertical-align:middle;visibility:display;" id="gmode_indicator" src="{ROOT_PATH}chat/images/14_layer_visible.png" alt="" /> {GMODE_OPT} <input title="{L_CHAT_GMODEIDHLP}" type="text" maxlength="5" tabindex="3" name="to_room" id="to_room" size="3" style="display:none;" /><!-- ENDIF --><br />
					<!-- IF CHATPM_OPT --><input type="hidden" name="to_user_id" value="0" /><!-- ENDIF -->
					<!-- IF ACOMMANDS_OPT --><input type="hidden" name="acomm" value="" /><!-- ENDIF -->
					</form>
				</td>
			</tr>
			<!-- IF S_BBCODE_WINDOW -->
			<tr>
				<td class="bg1" colspan="3" height="25" align="center">
					<input type="button" class="button2" name="addbbcode0" value=" B " style="font-weight:bold;" onclick="bbstyle(0)" title="{L_BBCHAT_B}" />
					<input type="button" class="button2" name="addbbcode2" value=" i " style="font-style:italic;" onclick="bbstyle(2)" title="{L_BBCHAT_I}" />
					<input type="button" class="button2" name="addbbcode4" value=" u " style="text-decoration: underline;" onclick="bbstyle(4)" title="{L_BBCHAT_U}" />
					<input type="button" class="button2" name="addbbcode6" value=" s " style="text-decoration: line-through;" onclick="bbstyle(6)" title="{L_BBCHAT_S}" />
					<input type="button" class="button2" name="addbbcode8" value=" samp " onclick="bbstyle(8)" title="{L_BBCHAT_SAMP}" />
					<input type="button" class="button2" name="addbbcode10" value=" color= " onclick="bbstyle(10)" title="{L_BBCHAT_COLOR}" />
					<input type="button" class="button2" name="addbbcode12" value=" size= " onclick="bbstyle(12)" title="{L_BBCHAT_SIZE}" />
					<input type="button" class="button2" name="addbbcode14" value=" url " onclick="bbstyle(14)" title="{L_BBCHAT_URL}" />
					<input type="button" class="button2" name="addbbcode16" value=" url= " onclick="bbstyle(16)" title="{L_BBCHAT_URL2}" />
					<input type="button" class="button2" name="addbbcode18" value=" q " onclick="bbstyle(18)" title="{L_BBCHAT_Q}" />
					<input type="button" class="button2" name="addbbcode20" value=" blockquote " onclick="bbstyle(20)" title="{L_BBCHAT_BLOCKQUOTE}" />
					<input type="button" class="button2" name="addbbcode22" value=" pre " onclick="bbstyle(22)" title="{L_BBCHAT_PRE}" />
					<input type="button" class="button2" name="addbbcode24" value=" code " onclick="bbstyle(24)" title="{L_BBCHAT_CODE}" />
					<input type="button" class="button2" name="addbbcode26" value=" noparse " onclick="bbstyle(26)" title="{L_BBCHAT_NOPARSE}" />
					<!-- IF S_BBCODE_IMG --><input type="button" class="button2" name="addbbcode28" value=" img= " onclick="bbstyle(28)" title="{L_BBCHAT_IMG}" /><!-- ENDIF -->
				</td>
			</tr>
			<!-- ENDIF -->
			<!-- IF S_MESSAGE_WINDOW or S_USER_WINDOW or S_BAR_WINDOW -->
			<tr class="bg1">
				<td style="width:10%;" valign="top">
					<!-- IF S_BAR_WINDOW -->
					<div class="smilies" id="smyles">{CHATSMILIES}</div>
					<!-- ENDIF -->
				</td>
				<td style="width:70%;" valign="top" id="td_shouts">
						<!-- IF S_MESSAGE_WINDOW -->
						<div class="shouts" id="shouts">
							<div id="chat_window"></div>
						</div>
						<!-- ENDIF -->
				</td>
				<td valign="top" style="width:20%;">
						<!-- IF S_USER_WINDOW -->
						<div class="users" id="users"></div>
						<!-- ENDIF -->
				</td>
			</tr>
			<!-- ENDIF -->
			<!-- IF S_CHAT_NOTIN -->
			<!-- <tr class="bg1">
				<td colspan="3" align="center" valign="middle" height="35">{L_CHAT_LOGIN}</td>
			</tr> -->
			<!-- ENDIF -->
			<!-- IF S_ONLINE_WINDOW -->
			<tr class="bg1">
				<td colspan="3" align="center" valign="middle" height="35">{ONLINE_MESSAGE}</td>
			</tr>
			<!-- ENDIF -->
			<tr class="bg1">
				<td colspan="3" align="center" valign="middle"><!-- IF ARCH_OPT -->{ARCH_OPT}<!-- ENDIF -->&nbsp;<!-- IF GMODE_OPT -->{ADM_OPT}<!-- ENDIF -->&nbsp;<!-- IF not S_CHAT_NOTIN -->{CHAT_TUPDATE}&nbsp;<b>{L_CHAT_HEIGHT}</b>: [<a title="{L_CHAT_PHEIGHT}" href="javascript:void(0);" class="chat_pheight">+</a> / <a title="{L_CHAT_MHEIGHT}" href="javascript:void(0);" class="chat_mheight">-</a> / <a title="{L_CHAT_OHEIGHT}" href="javascript:void(0);" class="chat_height">=</a>]<!-- ENDIF --></td>
			</tr>
			<!-- IF ARCH_OPT -->
			<tr class="bg2">
				<td colspan="3" align="center" valign="middle"><div id="chat_arch"></div></td>
			</tr>
			<!-- ENDIF -->
			</table>
			<!-- ENDIF -->
			</dd>
		</dl>
	</li>
</ul>
<!-- IF not $S_IN_PORTAL -->
		</ul>
	<span class="corners-bottom"><span></span></span></div>
</div>
<br />
<!-- ELSE -->
{$C_BLOCK_F_L}{$C_BLOCK_F_R}
<!-- ENDIF -->
